<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: 22307
  Date: 2025/9/22
  Time: 09:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    ArrayList<String> list = new ArrayList<>();
    list.add("张三");
    list.add("李四");
    list.add("王五");
    list.add("赵六");

    request.setAttribute("list", list);
%>
<table width="300px" border="1" cellspacing="0">
    <tr>
        <td>序号</td>
        <td>姓名</td>
    </tr>
    <c:if test="${list.size()>0}">
        <c:forEach items="${list}" var="element" varStatus="status">
            <tr align="center">
                <td>${status.count}</td>
                <td>${element}</td>
            </tr>
        </c:forEach>
    </c:if>
</table>
</body>
</html>
